import { createAsyncThunk, createSlice } from "@reduxjs/toolkit";
import { getHeightPriceRoomApi } from "@/service/module";

export const getHomeData = createAsyncThunk('getHomeData' , async (extra, { dispatch }) => {
  const res = await getHeightPriceRoomApi()
  dispatch(setHeigthPriceRoom(res))
})

const homeSlice = createSlice({
  name: "home",
  initialState: {
    heigthPriceRoom: []
  },
  reducers: {
    setHeigthPriceRoom: (state, action) => {
      state.heigthPriceRoom = action.payload;
    }
  }
})

export const { setHeigthPriceRoom } = homeSlice.actions;

export default homeSlice.reducer;